Fix alternate lang tags #3
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
The search index for the legacy site (in english) is kinda borked. For many pages, neither the
legacy.reactjs.org/{slug}
site is indexed, nor thereactjs.org/{slug}
site. When this happens, Google is returning results for the first translated site with matches, and since many of the translated sites still have english content, a partially translated doc is indexed.Why is this happening
According to the Google search console, when this happens it's because:
reactjs.org
: Page is not indexed, redirects tolegacy.reactjs.org
🛑legacy.reactjs.org
: Page is not indexed, alternate page with proper canonical tag{lang.reactjs.org}
🛑Why doesn't this happen on all pages?
If you look deeper, you'll see that this doesn't happen on e.g. the Getting Started page:
Looking at the Google Search index, you see:
reactjs.org
: Page is not indexed, redirects tolegacy.reactjs.org
🛑legacy.reactjs.org
: Page is indexed ✅I believe this is happening because all of the translated sites are fully translated to their corresponding language. So google doesn't trigger the "Alternate page with proper canonical tag" rule for those pages.
Fix
I've added
legacy
to allhttps://reactjs.org
link, but we'll also need to update all of the translated docs repos to make the same change. Additionally, if we migrate thehttps://{lang}.reactjs.org
sites tohttps://{lang}.legacy.reactjs.org
we'll need to update every repo.Before
After